How to Simple Commands to Delete Files in Windows
نوشته شده توسط : ashley

With simple commands, you can delete any file you would like from the Command Prompt. Follow the below steps to learn how.

Using command prompt and PowerShell, that you can do almost anything on Windows 10. Deleting a file or a bunch of files is certainly not hard. Though you can certainly delete files by pressing the Delete key on your keyboard, there can be times when you should utilize the commands to delete files.

So, in this short tutorial allow me to show you the simple commands to delete files in Windows.

Command to Delete Files

When you want to delete something via the Command Prompt, you will find multiple scenarios. For instance, you can delete just one file, delete multiple files, delete files with a specific extension, delete read-only files, etc.

To create things easier, I've divided the commands into their own sections. Depending on what you are looking for, click on the jump link below to see the command usage.

Files deleted via below commands are not moved to the Trash can. i.e, they're deleted permanently. That implies that you cannot recover them. So, be careful by what you are deleting.

The del commands shown below will also use PowerShell.

1]. Command to delete a single file

To delete a single file, all you need to do is perform single command with the file name.

1. First, search for cmd within the start menu, right-click on Command Prompt and choose Run as administrator choice to open a heightened command prompt.

Note: You are able to delete files without admin privileges so long as the files fit in with your user account.

2. Now, make use of the cd command to visit the folder where the files you want to delete are located. For instance, the files I want to delete are in a folder named "del" on my desktop. So, I use the next command.

cd c:\users\vamsi\desktop\del

When you are within the folder, simply execute the below command to delete personal files. Don't forget to replace <filename> with the actual file name along with its file extension. With my case, the file name is image-1.jpg.

del <filename>

Whenever you successfully delete a file, you will not see any confirmation message. However, when there is any difficulty, the command prompt can have a mistake message.

2]. Delete multiple files with a command

There's two ways to delete multiple files within the command prompt. In the first method, you will specify all the file names manually. This provides you best control over the files you delete. The 2nd technique is to use the wildcard. This is helpful for bulk delete operations.

2.1 Specify file names manually

If you have multiple specific files to delete, you are able to manually specify the file names. The benefit of this process is that you is only going to delete those files and ignore all others.

1. Just like before, open the Command Prompt and visit the folder in which the files to delete are located.

2. Next, execute the below command while replacing <filname1>, <filename2>, etc., with the actual filenames. You can specify as numerous filenames as you would like.

del <filename1> <filename2>

2.2 Bulk delete files with a wildcard

To bulk delete files inside a folder, you can use * ( wildcard ). The wildcard feature is extremely useful when you want to delete all files, files having a specific name, files with a specific extension, etc., inside a folder.

1. To delete all files in a folder, use the below command.

2. As you are deleting all of the files inside a folder, Windows will warn you. Simply type Y and press Enter to confirm file deletion.

del *

3. Delete all files that start with a specific name. The below command will delete all the files with the name that begins with "image".

del image*

4. Delete all files which contain a specific word. The below command will delete all the files using the name which contains "tFile".

del *tFile*

3]. Command to delete files with a specific extension

1. If you are searching to delete files that have a specific file extension you'll be able to use the below command. Don't forget to replace "fileExtension" using the actual file extension, like png, jpg, zip, etc.

del *.fileExtension

For example, to delete all the PNG files in a folder, the command with look something like this.

del *.png

2. To delete all files having a specific name and file extension, make use of the below command. Don't forget to replace the file name and extension to match your needs.

del ima*.png

4]. Delete read-only file with Command Prompt

Read-only files are safe and tend to be hard to delete, by design. By trying to delete a read-only file via command prompt while using above command, you'll receive "Access is denied" error message.

To delete a read-only via the command prompt, you have to force it.

1. Open the command prompt and navigate to in which the file is located.

2. When you are here, make use of the below command. Replace <filename> using the actual filename.

del /f <filename>

3. As an alternative, you may also make use of this command to delete read-only files.

del /a:r <filename>

Overall

As you can tell, commands to delete files in Windows are pretty simple and straight forward. You just need just one command and you are all set.





:: بازدید از این مطلب : 237
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0
تاریخ انتشار : جمعه 18 بهمن 1398 | نظرات ()
مطالب مرتبط با این پست
لیست
می توانید دیدگاه خود را بنویسید


نام
آدرس ایمیل
وب سایت/بلاگ
:) :( ;) :D
;)) :X :? :P
:* =(( :O };-
:B /:) =DD :S
-) :-(( :-| :-))
نظر خصوصی

 کد را وارد نمایید:

آپلود عکس دلخواه: